home *** CD-ROM | disk | FTP | other *** search
- package horst;
-
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Insets;
- import java.awt.Rectangle;
- import java.awt.Shape;
- import java.awt.Toolkit;
- import java.util.Enumeration;
- import java.util.Stack;
- import java.util.Vector;
-
- public class View {
- public static final int Y_AXIS = 0;
- public static final int X_AXIS = 1;
- public static final int LEFT_ALIGN = 0;
- public static final int CENTER_ALIGN = 1;
- public static final int RIGHT_ALIGN = 2;
- static URLClassLoader m_classLoader = new URLClassLoader();
- protected View[] m_children;
- protected Rectangle m_bounds;
- protected Insets m_insets;
- protected Element m_elem;
- protected View m_parent;
- protected HTMLPane m_container;
- protected int m_alignment;
- protected ViewLine[] m_rows;
- protected View[] m_floaters;
- protected boolean m_bCanWrap;
- protected int m_prefWidth;
- protected int m_prefHeight;
- protected int m_minWidth;
- protected int m_minHeight;
- private Vector m_floats = new Vector();
- private int m_totalSpan;
- private int m_yPos;
- private int m_leftRenderingArea;
- private int m_targetWidth;
- private ViewLine m_line;
- private Vector m_layoutRows = new Vector();
- private View m_view;
- private Stack m_viewStack = new Stack();
- private Vector m_pushedViews = new Vector();
-
- public View(View parent, Element e, HTMLPane container) {
- this.m_container = container;
- this.m_parent = parent;
- this.m_elem = e;
- this.m_bCanWrap = true;
- this.m_insets = new Insets(0, 0, 0, 0);
- this.m_bounds = new Rectangle();
- this.m_children = new View[0];
- this.m_rows = new ViewLine[0];
- this.m_floaters = new View[0];
- this.m_alignment = 0;
- this.m_prefWidth = -1;
- this.m_prefHeight = -1;
- this.m_minWidth = -1;
- this.m_minHeight = -1;
- this.init();
- }
-
- protected boolean alignInBounds() {
- return false;
- }
-
- private boolean canBackTrack() {
- if (this.m_view.getElementType() == 101) {
- int sz = this.m_line.vector.size();
- if (sz <= 1) {
- return false;
- }
-
- View v = (View)this.m_line.vector.elementAt(sz - 2);
- if (v.getElementType() != 101) {
- v = this.m_line.getLastView();
- this.m_totalSpan -= v.getPreferredSpan(1);
- this.m_viewStack.push(v);
- this.m_viewStack.push(this.m_view);
- return true;
- }
- }
-
- int idx = this.m_line.findNBSPBreak();
- if (idx != -1) {
- int sz = this.m_line.vector.size();
- View v = (View)this.m_line.vector.elementAt(sz - 2);
- if (v.getElementType() != 101) {
- for(int i = sz - 1; i >= idx; --i) {
- v = this.m_line.removeView(i);
- this.m_totalSpan -= v.getPreferredSpan(1);
- this.m_viewStack.push(v);
- }
-
- this.m_viewStack.push(this.m_view);
- return true;
- }
- }
-
- return false;
- }
-
- protected boolean canSplit(int width) {
- return false;
- }
-
- protected boolean contains(int x, int y) {
- return this.getBounds().contains(x, y);
- }
-
- protected ViewLine createALine(int x, int y, int width) {
- ViewLine row = new ViewLine();
- row.x = x;
- row.y = y;
- row.alignment = this.m_alignment;
- row.parent = this;
- row.lineWidth = width;
- return row;
- }
-
- protected void drawDebugBox(Graphics g, Color c) {
- }
-
- protected void drawFocusBox(Graphics g) {
- g.setColor(Color.black);
- Utilities.drawDottedRectangle(g, this.m_bounds.x, this.m_bounds.y, this.m_bounds.width, this.m_bounds.height);
- }
-
- protected View elementToView(Element e) {
- if (this.m_elem == e) {
- return this;
- } else {
- for(int row = 0; row < this.m_rows.length; ++row) {
- View[] views = this.m_rows[row].getViews();
-
- for(int j = 0; j < views.length; ++j) {
- View v = views[j].elementToView(e);
- if (v != null) {
- return v;
- }
- }
- }
-
- return null;
- }
- }
-
- protected synchronized void flushResources() {
- for(int i = 0; i < this.m_children.length; ++i) {
- this.m_children[i].flushResources();
- }
-
- }
-
- protected void forceLayout() {
- if (this.m_container != null) {
- this.m_container.forceLayout();
- }
-
- }
-
- protected Object getAttribute(Object key) {
- return this.m_elem.getAttributes().get(key);
- }
-
- public Rectangle getBounds() {
- return this.m_bounds;
- }
-
- protected int getDescent() {
- return 0;
- }
-
- protected HTMLDocument getDocument() {
- return this.m_container.getDocument();
- }
-
- protected int getElementType() {
- return this.m_elem.getType();
- }
-
- protected Font getFont() {
- Font f = this.m_elem.getFont();
- if (f == null) {
- f = new Font("Serif", 0, 12);
- }
-
- return f;
- }
-
- protected FontMetrics getFontMetrics() {
- return Toolkit.getDefaultToolkit().getFontMetrics(this.getFont());
- }
-
- protected int getMinimumSpan(int axis) {
- if (axis != 1) {
- return 0;
- } else if (this.m_minWidth != -1) {
- return this.m_minWidth;
- } else {
- boolean bLastNoBreakSpace = false;
- int maxRowSpan = 0;
- int span = 0;
- boolean bNewline = false;
- int nChildren = this.m_children.length;
-
- for(int i = 0; i < nChildren; ++i) {
- View v = this.m_children[i];
- if (bNewline || v.isNewlineView() || !bLastNoBreakSpace && this.m_bCanWrap && !v.isNoBreakSpace()) {
- maxRowSpan = Math.max(maxRowSpan, span);
- span = 0;
- bNewline = false;
- }
-
- if (v instanceof TextView) {
- boolean bCanWrap = this.m_bCanWrap;
- if (bLastNoBreakSpace || i != nChildren - 1 && this.m_children[i + 1] instanceof NBSPView) {
- bCanWrap = false;
- }
-
- if (bCanWrap) {
- span += ((TextView)v).getMaximumTokenLength();
- } else {
- span += v.getMinimumSpan(1);
- }
- } else {
- span += v.getMinimumSpan(1);
- }
-
- bNewline = v.isNextViewOnNewLine();
- bLastNoBreakSpace = v.isNoBreakSpace();
- }
-
- maxRowSpan = Math.max(maxRowSpan, span);
- this.m_minWidth = maxRowSpan + this.m_insets.left + this.m_insets.right;
- return this.m_minWidth;
- }
- }
-
- protected int getPreferredSpan(int axis) {
- if (axis != 1) {
- return 0;
- } else if (this.m_prefWidth != -1) {
- return this.m_prefWidth;
- } else {
- int maxRowSpan = 0;
- int span = 0;
- boolean bNewline = false;
-
- for(int i = 0; i < this.m_children.length; ++i) {
- View v = this.m_children[i];
- if (v.isNewlineView() || bNewline) {
- maxRowSpan = Math.max(maxRowSpan, span);
- span = 0;
- bNewline = false;
- }
-
- span += v.getPreferredSpan(1);
- bNewline = v.isNextViewOnNewLine();
- }
-
- maxRowSpan = Math.max(maxRowSpan, span);
- this.m_prefWidth = maxRowSpan + this.m_insets.left + this.m_insets.right;
- return this.m_prefWidth;
- }
- }
-
- protected Element getRootElement() {
- return this.m_container.getRootElement();
- }
-
- protected String getToolTipText() {
- return "";
- }
-
- protected void init() {
- }
-
- protected void invalidate() {
- this.m_prefWidth = -1;
- this.m_prefHeight = -1;
- this.m_minWidth = -1;
- this.m_minHeight = -1;
-
- for(View parent = this.m_parent; parent != null; parent = parent.m_parent) {
- parent.invalidate();
- }
-
- }
-
- protected boolean isAttributeDefined(Integer att) {
- return this.m_elem.getAttributes().containsKey(att);
- }
-
- protected boolean isBlockView() {
- return this.isNewlineView() && this.isNextViewOnNewLine();
- }
-
- protected boolean isContainerView() {
- return true;
- }
-
- protected boolean isDisplayableView() {
- return true;
- }
-
- protected boolean isFloater() {
- return false;
- }
-
- protected boolean isFloaterClearer() {
- return false;
- }
-
- protected boolean isLink() {
- return this.m_elem.getAttribute("href") != null;
- }
-
- protected boolean isNewlineView() {
- return false;
- }
-
- protected boolean isNextViewOnNewLine() {
- return false;
- }
-
- boolean isNoBreakSpace() {
- return false;
- }
-
- protected boolean isPlaceHolderView() {
- return false;
- }
-
- protected boolean isSelfContained() {
- return false;
- }
-
- protected boolean isSplittable() {
- return false;
- }
-
- protected boolean isWrappable() {
- return false;
- }
-
- protected Rectangle layout(int x, int y, int width, LayoutInfo info) {
- info.setPageBreak(y);
- this.m_bounds.setBounds(x, y, 0, 0);
- if (this.m_children.length == 0) {
- return this.m_bounds;
- } else {
- this.m_floats.removeAllElements();
- this.m_totalSpan = 0;
- this.m_viewStack.removeAllElements();
-
- for(int i = this.m_children.length - 1; i >= 0; --i) {
- this.m_viewStack.push(this.m_children[i]);
- }
-
- this.m_view = (View)this.m_viewStack.pop();
- this.m_yPos = y + this.m_insets.top;
- info.increaseInsetsRight(this.m_insets.right);
- info.increaseInsetsLeft(this.m_insets.left);
- this.m_leftRenderingArea = x + this.m_insets.left;
- width -= this.m_insets.left + this.m_insets.right;
- width = Math.max(0, width);
- this.m_line = this.createALine(this.m_leftRenderingArea, this.m_yPos, width);
- boolean bNewline = false;
- this.m_layoutRows.removeAllElements();
- this.m_targetWidth = Math.max(0, width - info.leftMargin - info.rightMargin);
- boolean bLastNoBreakSpace = false;
-
- while(true) {
- if (this.m_view.isPlaceHolderView()) {
- this.m_pushedViews.removeAllElements();
- this.pushOnViewStack(this.m_view.m_children, this.m_pushedViews);
- if (this.m_pushedViews.size() > 0) {
- this.m_view = (View)this.m_viewStack.pop();
- this.m_pushedViews.removeAllElements();
- }
- }
-
- if (this.m_view.isFloater()) {
- if (!bNewline && !this.m_line.isEmpty() && this.m_totalSpan != 0) {
- if (this.m_viewStack.empty()) {
- if (!this.m_line.isEmpty()) {
- this.startNewLine(width, info);
- }
-
- this.layoutFloater(width, info, this.m_view);
- break;
- }
-
- info.pendingFloaters.addElement(this.m_view);
- bLastNoBreakSpace = this.m_view.isNoBreakSpace();
- this.m_view = (View)this.m_viewStack.pop();
- } else {
- if (!this.m_line.isEmpty()) {
- this.startNewLine(width, info);
- }
-
- this.layoutFloater(width, info, this.m_view);
- if (this.m_viewStack.empty()) {
- break;
- }
-
- bLastNoBreakSpace = this.m_view.isNoBreakSpace();
- this.m_view = (View)this.m_viewStack.pop();
- }
- } else {
- if (bNewline || this.m_view.isNewlineView()) {
- bNewline = false;
- if (!this.m_line.isEmpty()) {
- this.startNewLine(width, info);
- }
-
- if (this.m_view.isBlockView()) {
- this.m_line.addView(this.m_view);
- this.startNewLine(width, info);
- if (this.m_viewStack.empty()) {
- break;
- }
-
- bLastNoBreakSpace = this.m_view.isNoBreakSpace();
- this.m_view = (View)this.m_viewStack.pop();
- continue;
- }
- }
-
- if ((this.m_totalSpan == 0 || this.m_line.isEmpty()) && !this.m_view.setToLineStarter()) {
- if (this.m_viewStack.empty()) {
- break;
- }
-
- this.m_view = (View)this.m_viewStack.pop();
- } else {
- int span = this.m_view.getPreferredSpan(1);
- if (this.m_bCanWrap && !this.m_view.isNoBreakSpace() && !bLastNoBreakSpace && this.m_totalSpan + span > this.m_targetWidth) {
- int availSpace = this.m_targetWidth - this.m_totalSpan;
- if (this.m_view.canSplit(availSpace)) {
- View[] splits = this.m_view.split(availSpace);
- this.m_line.addView(splits[0]);
- this.startNewLine(width, info);
- this.m_view = splits[1];
- } else if (!this.m_line.isEmpty()) {
- this.startNewLine(width, info);
- } else if (this.m_view.isSplittable()) {
- View[] splits = this.m_view.split(availSpace);
- this.m_line.addView(splits[0]);
- this.startNewLine(width, info);
- if (splits[1] != null) {
- this.m_view = splits[1];
- } else {
- if (this.m_viewStack.empty()) {
- break;
- }
-
- this.m_view = (View)this.m_viewStack.pop();
- }
- } else {
- if (this.m_view.isDisplayableView()) {
- this.m_line.addView(this.m_view);
- }
-
- this.startNewLine(width, info);
- if (this.m_viewStack.empty()) {
- break;
- }
-
- bLastNoBreakSpace = this.m_view.isNoBreakSpace();
- this.m_view = (View)this.m_viewStack.pop();
- }
- } else if (this.m_bCanWrap && this.m_totalSpan + span > this.m_targetWidth && this.canBackTrack()) {
- this.startNewLine(width, info);
- if (this.m_viewStack.empty()) {
- break;
- }
-
- this.m_view = (View)this.m_viewStack.pop();
- } else if (bLastNoBreakSpace && this.m_totalSpan + span > this.m_targetWidth && this.m_view.isSplittable()) {
- int availSpace = this.m_targetWidth - this.m_totalSpan;
- View[] splits = this.m_view.split(availSpace);
- this.m_line.addView(splits[0]);
- bLastNoBreakSpace = false;
- this.startNewLine(width, info);
- if (splits[1] != null) {
- this.m_view = splits[1];
- } else {
- if (this.m_viewStack.empty()) {
- break;
- }
-
- this.m_view = (View)this.m_viewStack.pop();
- }
- } else {
- if (this.m_view.isDisplayableView()) {
- this.m_line.addView(this.m_view);
- }
-
- if (this.m_view.getElementType() == 7) {
- String clearAtts = (String)this.m_view.getAttribute("clear");
- if (clearAtts != null) {
- this.startNewLine(width, info);
- int yEndPosition = -1;
- if (clearAtts.equalsIgnoreCase("left")) {
- yEndPosition = info.clearLeftMargin();
- } else if (clearAtts.equalsIgnoreCase("right")) {
- yEndPosition = info.clearRightMargin();
- } else if (clearAtts.equalsIgnoreCase("all") || clearAtts.equalsIgnoreCase("both")) {
- yEndPosition = info.clearMargins();
- }
-
- this.m_targetWidth = Math.max(0, width - info.leftMargin - info.rightMargin);
- if (yEndPosition != -1 && yEndPosition > this.m_yPos) {
- ViewLine emptyLine = this.createALine(this.m_leftRenderingArea, this.m_yPos, width);
- emptyLine.bounds = new Rectangle(emptyLine.x, emptyLine.y, emptyLine.lineWidth, yEndPosition - this.m_yPos);
- this.m_layoutRows.addElement(emptyLine);
- this.m_yPos = yEndPosition;
- this.m_line.y = yEndPosition;
- if (this.m_viewStack.empty()) {
- break;
- }
-
- bLastNoBreakSpace = this.m_view.isNoBreakSpace();
- this.m_view = (View)this.m_viewStack.pop();
- continue;
- }
- }
- }
-
- bNewline = this.m_view.isNextViewOnNewLine();
- this.m_totalSpan += span;
- if (this.m_viewStack.empty()) {
- this.startNewLine(width, info);
- break;
- }
-
- bLastNoBreakSpace = this.m_view.isNoBreakSpace();
- this.m_view = (View)this.m_viewStack.pop();
- }
- }
- }
- }
-
- this.m_rows = new ViewLine[this.m_layoutRows.size()];
- this.m_layoutRows.copyInto(this.m_rows);
- this.m_floaters = new View[this.m_floats.size()];
- this.m_floats.copyInto(this.m_floaters);
-
- for(int i = 0; i < this.m_rows.length; ++i) {
- this.m_bounds.add(this.m_rows[i].bounds);
- }
-
- if (this.m_alignment == 1 || this.m_alignment == 2) {
- for(int j = 0; j < this.m_rows.length; ++j) {
- this.m_rows[j].alignmentAdjust();
- }
-
- if (!this.alignInBounds() && this.m_bounds.width < width) {
- this.m_bounds.width = width;
- }
- }
-
- if (this.isFloaterClearer()) {
- int currentYEnd = this.m_bounds.y + this.m_bounds.height;
- int yEnd = info.clearMargins();
- if (yEnd > currentYEnd) {
- Rectangle var10000 = this.m_bounds;
- var10000.height += yEnd - currentYEnd;
- }
- }
-
- Rectangle var23 = this.m_bounds;
- var23.width += this.m_insets.right;
- var23 = this.m_bounds;
- var23.height += this.m_insets.bottom;
- info.decreaseInsetsRight(this.m_insets.right);
- info.decreaseInsetsLeft(this.m_insets.left);
- return this.m_bounds;
- }
- }
-
- protected void layoutFloater(int parentWidth, LayoutInfo info, View view) {
- LayoutInfo floaterInfo = new LayoutInfo();
- floaterInfo.bPaginate = info.bPaginate;
- int xOffset = view.m_alignment == 0 ? info.leftMargin : 0;
- Rectangle bounds = view.layout(this.m_leftRenderingArea + xOffset, this.m_yPos, this.m_targetWidth, floaterInfo);
- if (view.m_alignment == 2) {
- xOffset = Math.max(0, parentWidth - info.rightMargin - bounds.width);
- if (xOffset > 0) {
- view.move(xOffset, 0, true);
- }
-
- FloatStackItem item = new FloatStackItem(info.insetsRight + bounds.width, bounds.y + bounds.height);
- info.pushRight(item);
- } else {
- FloatStackItem item = new FloatStackItem(info.insetsLeft + bounds.width, bounds.y + bounds.height);
- info.pushLeft(item);
- }
-
- this.m_targetWidth = Math.max(0, parentWidth - info.leftMargin - info.rightMargin);
- this.saveFloater(view);
- }
-
- protected void layoutPendingFloaters(int x, int width, LayoutInfo info) {
- Vector leftFloaters = new Vector();
- Vector rightFloaters = new Vector();
-
- View floater;
- for(Enumeration e = info.pendingFloaters.elements(); e.hasMoreElements(); this.saveFloater(floater)) {
- floater = (View)e.nextElement();
- if (floater.m_alignment == 0) {
- leftFloaters.addElement(floater);
- } else {
- rightFloaters.addElement(floater);
- }
- }
-
- int xPos = x;
- int targetWidth = Math.max(0, width - info.rightMargin - info.leftMargin);
- int renderingWidth = targetWidth;
- Enumeration e = leftFloaters.elements();
-
- while(e.hasMoreElements()) {
- View floater = (View)e.nextElement();
- new LayoutInfo();
- Rectangle bounds = floater.layout(xPos, this.m_yPos, renderingWidth, info);
- xPos += bounds.width;
- renderingWidth -= bounds.width;
- renderingWidth = Math.max(renderingWidth, 0);
- info.pushLeft(new FloatStackItem(bounds.width, bounds.y + bounds.height));
- }
-
- xPos = x;
- renderingWidth = targetWidth;
- Enumeration e = rightFloaters.elements();
-
- while(e.hasMoreElements()) {
- View floater = (View)e.nextElement();
- Rectangle bounds = floater.layout(xPos, this.m_yPos, renderingWidth, new LayoutInfo());
- int xOffset = Math.max(0, renderingWidth - bounds.width);
- floater.move(xOffset, 0, true);
- renderingWidth -= bounds.width;
- renderingWidth = Math.max(renderingWidth, 0);
- info.pushRight(new FloatStackItem(bounds.width, bounds.y + bounds.height));
- }
-
- info.pendingFloaters.removeAllElements();
- }
-
- protected synchronized void loadResources() {
- for(int i = 0; i < this.m_children.length; ++i) {
- this.m_children[i].loadResources();
- }
-
- }
-
- protected void makeChildren(ViewFactory factory) {
- int nCount = this.m_elem.getElementCount();
- this.m_children = new View[nCount];
-
- for(int i = 0; i < nCount; ++i) {
- this.m_children[i] = factory.createView(this, this.m_elem.getElementAt(i), this.m_container);
- }
-
- for(int i = 0; i < nCount; ++i) {
- this.m_children[i].makeChildren(factory);
- }
-
- }
-
- protected View modelToView(int pos) {
- if (pos >= this.m_elem.m_p0 && pos <= this.m_elem.m_p1) {
- return this;
- } else {
- for(int row = 0; row < this.m_rows.length; ++row) {
- View[] views = this.m_rows[row].getViews();
-
- for(int j = 0; j < views.length; ++j) {
- View v = views[j].modelToView(pos);
- if (v != null) {
- return v;
- }
- }
- }
-
- return null;
- }
- }
-
- protected void move(int x, int y, boolean bMoveFloaters) {
- for(int i = 0; i < this.m_rows.length; ++i) {
- this.m_rows[i].move(x, y, bMoveFloaters);
- }
-
- if (bMoveFloaters) {
- Rectangle b = this.getBounds();
-
- for(int i = 0; i < this.m_floaters.length; ++i) {
- if (this.m_floaters[i].getBounds().intersects(b)) {
- this.m_floaters[i].move(x, y, bMoveFloaters);
- }
- }
- }
-
- Rectangle var10000 = this.m_bounds;
- var10000.x += x;
- var10000 = this.m_bounds;
- var10000.y += y;
- }
-
- protected int pageBreakAdjust(LayoutInfo info) {
- info.setPageBreak(this.getBounds().y);
- Rectangle origBounds = new Rectangle(this.m_bounds);
-
- for(int row = 0; row < this.m_rows.length; ++row) {
- int rowAdjustment = this.m_rows[row].pageBreakAdjust(info);
- if (rowAdjustment > 0 && row != this.m_rows.length - 1) {
- for(int j = row + 1; j < this.m_rows.length; ++j) {
- this.m_rows[j].move(0, rowAdjustment, true);
- }
- }
- }
-
- for(int i = 0; i < this.m_rows.length; ++i) {
- this.m_bounds.add(this.m_rows[i].bounds);
- }
-
- return this.m_bounds.height - origBounds.height;
- }
-
- public void paint(Graphics g, Shape allocation) {
- Rectangle clip = allocation.getBounds();
- if (this.m_bounds.intersects(clip)) {
- for(int row = 0; row < this.m_rows.length; ++row) {
- View[] views = this.m_rows[row].getViews();
-
- for(int j = 0; j < views.length; ++j) {
- views[j].paint(g, clip);
- }
- }
-
- if (this.m_elem.getType() == 10) {
- this.drawDebugBox(g, Color.blue);
- }
- }
-
- }
-
- protected void paintFocusBox(Graphics g, Shape allocation) {
- Rectangle clip = allocation.getBounds();
- if (this.m_bounds.intersects(clip)) {
- if (this.m_elem.getDrawFocusBox()) {
- g.setColor(Color.black);
- Utilities.drawDottedRectangle(g, this.m_bounds.x, this.m_bounds.y, this.m_bounds.width, this.m_bounds.height);
- }
-
- for(int row = 0; row < this.m_rows.length; ++row) {
- View[] views = this.m_rows[row].getViews();
-
- for(int j = 0; j < views.length; ++j) {
- views[j].paintFocusBox(g, clip);
- }
- }
- }
-
- }
-
- private void pushOnViewStack(View[] vws, Vector pushedViews) {
- if (vws != null) {
- for(int i = vws.length - 1; i >= 0; --i) {
- if (vws[i] != null) {
- if (vws[i].isPlaceHolderView()) {
- this.pushOnViewStack(vws[i].m_children, pushedViews);
- } else {
- this.m_viewStack.push(vws[i]);
- pushedViews.addElement(vws[i]);
- }
- }
- }
- }
-
- }
-
- protected void reset() {
- for(int i = 0; i < this.m_children.length; ++i) {
- this.m_children[i].reset();
- }
-
- }
-
- protected void saveFloater(View v) {
- this.m_container.addFloater(v);
- this.m_floats.addElement(v);
- }
-
- protected void setCanWrap(boolean bWrap) {
- for(int i = 0; i < this.m_children.length; ++i) {
- if (!this.m_children[i].isSelfContained()) {
- this.m_children[i].setCanWrap(bWrap);
- }
- }
-
- this.m_bCanWrap = bWrap;
- }
-
- protected void setDimensions(int width, int height) {
- Rectangle var10000 = this.m_bounds;
- var10000.width += Math.max(0, width - this.m_bounds.width);
- var10000 = this.m_bounds;
- var10000.height += Math.max(0, height - this.m_bounds.height);
- }
-
- protected void setInsets(int top, int left, int bottom, int right) {
- this.m_insets.top = top;
- this.m_insets.left = left;
- this.m_insets.bottom = bottom;
- this.m_insets.right = right;
- }
-
- protected boolean setToLineStarter() {
- return true;
- }
-
- protected View[] split(int width) {
- return null;
- }
-
- protected void startNewLine(int width, LayoutInfo info) {
- this.m_line.layout(width, this.m_targetWidth, info);
- this.m_yPos += this.m_line.height + this.m_line.descent;
- this.m_layoutRows.addElement(this.m_line);
- if (info.pendingFloaters.size() > 0) {
- this.layoutPendingFloaters(this.m_leftRenderingArea, width, info);
- }
-
- while(info.leftMargin > 0) {
- int yEnd = info.getLeftYEnd();
- if (this.m_yPos < yEnd) {
- break;
- }
-
- info.popLeft();
- }
-
- while(info.rightMargin > 0) {
- int yEnd = info.getRightYEnd();
- if (this.m_yPos < yEnd) {
- break;
- }
-
- info.popRight();
- }
-
- this.m_line = this.createALine(this.m_leftRenderingArea, this.m_yPos, width);
- this.m_totalSpan = 0;
- this.m_targetWidth = Math.max(0, width - info.leftMargin - info.rightMargin);
- }
-
- protected ElementViewInfo viewToModel(int x, int y) {
- ElementViewInfo info = null;
- Rectangle bounds = this.getBounds();
- if (bounds.contains(x, y)) {
- for(int row = 0; row < this.m_rows.length; ++row) {
- View[] views = this.m_rows[row].getViews();
-
- for(int j = 0; j < views.length; ++j) {
- if (views[j].contains(x, y)) {
- info = views[j].viewToModel(x, y);
- if (info != null) {
- break;
- }
- }
- }
- }
-
- if (info == null) {
- info = new ElementViewInfo(this.m_elem, this);
- }
- }
-
- return info;
- }
- }
-